package com.chinacoal.hr.levelapi.client;

import com.chinacoal.hr.levelapi.client.fallback.LevelRecordClientFallback;
import com.chinacoal.hr.levelapi.client.response.Result;
import com.chinacoal.hr.levelapi.entity.LeaveRecord;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.cloud.openfeign.FeignAutoConfiguration;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

/**
 * Created by jinyabin on 2020/10/29.
 */
@Api(tags = {"查询请假"})
@FeignClient(name = "ccip-hr-attendance",configuration = FeignAutoConfiguration.class,fallback = LevelRecordClientFallback.class)
public interface LevelRecordClient {



    /**
     * 查询请假记录列表
     *
     * @param page           : 当前页数
     * @param limit          : 每页条数
     * @param orgCode        : 组织机构
     * @param holidayType    : 假期类型
     * @param businessStatus : 审批状态
     * @param startDate      : 开始时间
     * @param endDate        : 结束时间
     * @param queryRange     :查询范围（all、dept、person）
     * @return : com.chinacoal.hr.levelapi.response.Result
     * @author : YunTao.Li
     * @date : 2019/11/15 2019/11/15
     */
    @ResponseBody
    @GetMapping("/leaves")
    @ApiOperation(value = "查询请假记录列表")
    public Result list(@ApiParam("当前页数") long page,
                       @ApiParam("每页条数") long limit,
                       @ApiParam("组织机构") String orgCode,
                       @ApiParam("部门编码") String deptCode,
                       @ApiParam("部门名称") String deptName,
                       @ApiParam("员工姓名") String empName,
                       @ApiParam("员工编码") String empCode,
                       @ApiParam("假期类型") String holidayType,
                       @ApiParam("审批状态") String businessStatus,
                       @ApiParam("开始时间") String startDate,
                       @ApiParam("结束时间") String endDate,
                       @ApiParam("查询范围") String queryRange) ;



    /**
     * 新增请假单信息
     *
     * @param record :
     * @return : com.chinacoal.hr.levelapi.response.Result
     * @author : YunTao.Li
     * @date : 2019/11/15 2019/11/15
     */
    @PostMapping("/leave")
    @ApiOperation(value = "新增请假单")
    public Result add(@RequestBody LeaveRecord record);




    /**
     * 修改请假单信息
     *
     * @param record :
     * @return : com.chinacoal.hr.levelapi.response.Result
     * @author : YunTao.Li
     * @date : 2019/11/15 2019/11/15
     */
    @PutMapping("/leave/{levelId}")
    @ApiOperation(value = "编辑请假单")
    public Result update(@PathVariable String levelId,
                         @RequestBody LeaveRecord record) ;




    /**
     * 删除请假单
     *
     * @param levelId :
     * @return : com.chinacoal.hr.levelapi.response.Result
     * @author : YunTao.Li
     * @date : 2019/11/16 2019/11/16
     */
    @DeleteMapping("/leave/{levelId}")
    @ApiOperation(value = "删除请假单")
    public Result delete(@PathVariable String levelId) ;





    /**
     * 提交请假单信息
     *
     * @param record :
     * @return : com.chinacoal.hr.levelapi.response.Result
     * @author : YunTao.Li
     * @date : 2019/11/15 2019/11/15
     */
    @PutMapping("/leave/{levelId}/submit")
    @ApiOperation(value = "提交请假单")
    public Result submit(@PathVariable String levelId,
                         @RequestBody LeaveRecord record) ;




    /**
     * 撤回请请假单
     *
     * @param levelId :
     * @param record  :
     * @return : com.chinacoal.hr.levelimpl.response.Result
     * @author : YunTao.Li
     * @date : 2019/12/12 2019/12/12
     */
    @PutMapping("/leave/{levelId}/drawback")
    @ApiOperation(value = "撤回请假单")
    public Result drawback(@PathVariable String levelId,
                           @RequestBody LeaveRecord record);


}
